var app = new Vue({ el: '#app', data: { backBanner: "", solution: [], solution_type: 1, id: null, array: [], solutionArray:[], solutionTypes: [], colin: '' }, computed: { }, created: function () { this.solution_type = this.getQueryVariable('solution_type') this.id = this.getQueryVariable('id') this.backBanner = '../assets/img/solution/solution-banner1.jpg' }, mounted: function () { _this=this this.getColumnData() $.ajax({ type: 'POST', dataType: 'json', url: window.FQDN + 'Solution/index', data: { id: '1' } }).done(function (arr) { _this.array = arr; console.log(_this.array) }).fail(function (err) {}); }, methods: { //获取内容 getArticalData(param){ $.ajax({ type: 'GET', dataType: 'json', url: window.FQDN2 + 'siteArticle/siteArticleList', data: { categoryid: param } }).done(function (res) { console.log(res); var aa=res.data.records aa.sort(_this.compare("lmtitle")) _this.solutionArray=aa }).fail(function (err) {}); }, //获取栏目 getColumnData() { $.ajax({ type: 'get', dataType: 'json', url: window.FQDN2 + 'siteCategory/siteCategoryList', }).done(function (res) { for (let i = 0; i < res.data.length; i++) { console.log(res.data[i].sname) console.log(window.location.pathname) if (res.data[i].children.length > 0) { if (res.data[i].categoryName == '解决方案') { _this.solutionTypes=res.data[i].children _this.colin=_this.getQueryVariable('id')?_this.getQueryVariable('id'): _this.solutionTypes[0].id; _this.getArticalData( _this.id ? _this.id : _this.solutionTypes[0].id) } } } }) }, // 排序 compare(property) { return function (a, b) { var value1 = a[property]; var value2 = b[property]; return value1 - value2; } }, //解决方案类型点击 facilityClick(e, item) { this.colin = item.id this.getArticalData(item.id) console.log(item.id) }, getQueryVariable: function (variable) { var query = window.location.search.substring(1); var vars = query.split("&"); for (var i = 0; i < vars.length; i++) { var pair = vars[i].split("="); if (pair[0] == variable) { return pair[1]; } } return (false); } } });